package com.zhhh.domain;
// Generated 2019-9-27 10:55:05 by Hibernate Tools 3.4.0.CR1

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * BOrganization generated by hbm2java
 */
@Entity
@Table(name = "b_organization")
public class BOrganization implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Integer id;
	private String osysCode;
	private String ocode;
	private String oname;
	private String odesc;
	private Integer pid;
	private String remark;
	private Integer sortno;
	private Integer ifComp;
	private Integer ifPm;
	private Integer ifDm;
	private Integer ifTm;
	private String manger;

	private List<BOrganization> childList = new ArrayList<BOrganization>();
	
	private List<BPosition> positions = new ArrayList<BPosition>();

	private List<BUser> users = new ArrayList<BUser>();

	public BOrganization() {
	}

	public BOrganization(String osysCode, String ocode, String oname, String odesc, Integer pid, String remark,
			Integer sortno, Integer ifComp, Integer ifPm, Integer ifDm, Integer ifTm, String manger) {
		this.osysCode = osysCode;
		this.ocode = ocode;
		this.oname = oname;
		this.odesc = odesc;
		this.pid = pid;
		this.remark = remark;
		this.sortno = sortno;
		this.ifComp = ifComp;
		this.ifPm = ifPm;
		this.ifDm = ifDm;
		this.ifTm = ifTm;
		this.manger = manger;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "o_sys_code", length = 60)
	public String getOsysCode() {
		return this.osysCode;
	}

	public void setOsysCode(String osysCode) {
		this.osysCode = osysCode;
	}

	@Column(name = "o_code", length = 60)
	public String getOcode() {
		return this.ocode;
	}

	public void setOcode(String ocode) {
		this.ocode = ocode;
	}

	@Column(name = "o_name", length = 40)
	public String getOname() {
		return this.oname;
	}

	public void setOname(String oname) {
		this.oname = oname;
	}

	@Column(name = "o_desc", length = 60)
	public String getOdesc() {
		return this.odesc;
	}

	public void setOdesc(String odesc) {
		this.odesc = odesc;
	}

	@Column(name = "p_id", length = 40)
	public Integer getPid() {
		return this.pid;
	}

	public void setPid(Integer pid) {
		this.pid = pid;
	}

	@Column(name = "remark", length = 400)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "sortno")
	public Integer getSortno() {
		return this.sortno;
	}

	public void setSortno(Integer sortno) {
		this.sortno = sortno;
	}

	@Column(name = "if_comp")
	public Integer getIfComp() {
		return this.ifComp;
	}

	public void setIfComp(Integer ifComp) {
		this.ifComp = ifComp;
	}

	@Column(name = "if_pm")
	public Integer getIfPm() {
		return this.ifPm;
	}

	public void setIfPm(Integer ifPm) {
		this.ifPm = ifPm;
	}

	@Column(name = "if_dm")
	public Integer getIfDm() {
		return this.ifDm;
	}

	public void setIfDm(Integer ifDm) {
		this.ifDm = ifDm;
	}

	@Column(name = "if_tm")
	public Integer getIfTm() {
		return this.ifTm;
	}

	public void setIfTm(Integer ifTm) {
		this.ifTm = ifTm;
	}

	@Column(name = "manger", length = 10)
	public String getManger() {
		return this.manger;
	}

	public void setManger(String manger) {
		this.manger = manger;
	}

	/**
	 * @Transient注解： 该属性不需要与数据库映射
	 */
	@Transient
	public List<BOrganization> getChildList() {
		return childList;
	}

	public void setChildList(List<BOrganization> childList) {
		this.childList = childList;
	}

	//关联用户
	@ManyToMany(cascade = CascadeType.REFRESH, mappedBy = "organizations", fetch = FetchType.LAZY) 
	public List<BUser> getUsers() {
		return users;
	}

	public void setUsers(List<BUser> users) {
		this.users = users;
	}

	@ManyToMany(cascade = CascadeType.REFRESH, mappedBy = "organizations", fetch = FetchType.LAZY) 
	public List<BPosition> getPositions() {
		return positions;
	}

	public void setPositions(List<BPosition> positions) {
		this.positions = positions;
	}

}
